This is the first step to talk to an RFID Reader over the Generic Reader Interface. The root class for the RFID API is RFIDReader. It is possible to use the API to connect to RFID Reader while is acting as LLRP Server as well as LLRP Client.
RFID Reader acts in LLRP Server Mode - The RFIDReader class instance takes host name or IP address of the RFID-reader to connect, the port number and the response timeout. The default LLRP port number is 5084 and the default response time out is 5 seconds. Specifying zero for port number and timeout uses default values.
For Host-based readers, hostname shall be the IP address of the RFID Reader.
Import the package
import com.mot.rfid.api3.*;
// Establish connection to the RFID Reader
String hostname = "157.235.208.20";
RFIDReader reader = new RFIDReader(hostname, 0, 0);
reader.connect();
The timeout value is also used for configuring the Keep-Alive mechanism which helps in determining if the connection to the reader is alive or not. If the connection to the reader was inactive (i.e. no keep-alive message from the Reader) for a time greater than 10 times the timeout, DISCONNECTION_EVENT will be triggered to the application if the application has registered for the same.
Secured Connection
Secure LLRP mode allows encrypted and optionally authenticated connection to use LLRP service on the reader using SSL/TLS. Please refer Configure LLRP Settings and Certificates chapter in Reader Integrator Guide for configuring reader in Secure LLRP mode.
RFID API3 can internally manage secure connection to LLRP service and clients using RFID API3 can enable secure connection by setting options in SecureConnectionInfo property of RFIDReader object before calling Connect method
Please refer Reader Integrator Guide for documentation on generation of certificates for reader as well as client use. The example below illustrates use of SecureConnectionInfo property to establish a secure to connection to a reader which is configured to operate in Secure LLRP mode.
// Establish secure connection to the RFID Reader
String hostname =
"157.235.208.20";
RFIDReader reader = new RFIDReader(hostname, 0, 0);
// Secure Connection to the reader
SecureConnectionInfo secureLLRPConnection =
new SecureConnectionInfo();
secureLLRPConnection.setSecureMode(true);
secureLLRPConnection.setValidatePeerCertificate(false);
reader.SecureConnectionInfo = secureLLRPConnection;
reader.Connect();
Connect to RFID Module - The RFIDReader class instance takes comport and baudrate enum as input to connect to RFID Module .
Import the package
import rfid.api.*;
// Establish connection to the RFID Reader
RFIDReader reader = new RFIDReader("COM7", SUPPORTED_BAUDRATE._921600);
reader.connect();
Discover available comports - User can discover all the available comports where RFID Modules are connected. .
Import the package
import rfid.api.*;
// Call GetAvailableComports API to get all the available comports.It takes baudrate enum as input. Reader
List